package actionHandlers;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBoxMenuItem;
import palette.CanvasManager;
import palette.CanvasWindow;

public class GridHandler implements ActionListener{

	@Override
	public void actionPerformed(ActionEvent e) {
		
		JCheckBoxMenuItem temp = (JCheckBoxMenuItem) e.getSource();
		if (temp.isSelected()) {
			((CanvasWindow)CanvasManager.getInst().getSelectedFrame()).getCanvas().setGrid(true);
			((CanvasWindow)CanvasManager.getInst().getSelectedFrame()).getCanvas().repaint();
		}
		else {
			((CanvasWindow)CanvasManager.getInst().getSelectedFrame()).getCanvas().setGrid(false);
			((CanvasWindow)CanvasManager.getInst().getSelectedFrame()).getCanvas().repaint();
		}
		
	}

}
